package com.dnjn.happiness;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;

/**
 * 启动程序
 *
 * @author happy
 */
@Slf4j
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class HappinessApp {

    public static void main(String[] args) {
        SpringApplication.run(HappinessApp.class, args);
    }

    @Autowired
    private Environment env;

    @Bean
    public CommandLineRunner showConfig() {
        return args -> {
            log.warn("profile {}， port: {}", env.getActiveProfiles(), env.getProperty("server.port"));
            log.info("db master {}", env.getProperty("spring.datasource.druid.master.url"));
            log.info("api: \n\t/api/fer/open/uploadFileDemo\n\t/api/fer/open/uploadFile\n\t/api/fer/open/uploadFileA");
        };
    }
}
